import request from '@/utils/request'

/**
 *获取当前页面初始的渲染数据
 * @param {*} form
 * @returns
 */
export const getemplyees = (form) => {
  return request.get('/sys/user', { params: form })
}

/**
 *删除的方法
 * @param {*} id
 * @returns
 */
export const delgetemplyees = (id) => {
  return request.delete(`/sys/user/${id}`)
}

/**
 *添加的接口
 * @param {*} form
 * @returns
 */
export const addgetemplyees = (form) => {
  return request.post('/sys/user', form)
}

/**
 *批量添加到接口
 * @param {*} arr
 * @returns
 */
// export const addsgetemplyees = (arr) => {
//   return request.post('/sys/user/batch', arr)
// }
export const addsgetemplyees = arr => {
  return request.post('/sys/user/batch', arr)
}

/**
 *获取个人信息的接口
 * @param {*} id
 * @returns
 */
export const getgerenemplyees = id => {
  return request.get(`/employees/${id}/personalInfo`)
}

/** *
 * 保存员工的基本信息
 * **/
export function saveUserDetailByIdApi(data) {
  return request({
    method: 'put',
    url: `/sys/user/${data.id}`,
    data
  })
}

/**
 *修改员工的角色
 * @param {*} data
 * @returns
 */
export function assignRolesApi(data) {
  return request.put('/sys/user/assignRoles', data)
}
